home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / manageme / tcpdump-.7 / tcpdump- / tcpdump-richard-1.7 / tcpdump-3.0 / interface.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-17  |  5.6 KB  |  154 lines

  1. /*
  2.  * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that: (1) source code distributions
  7.  * retain the above copyright notice and this paragraph in its entirety, (2)
  8.  * distributions including binary code include the above copyright notice and
  9.  * this paragraph in its entirety in the documentation or other materials
  10.  * provided with the distribution, and (3) all advertising materials mentioning
  11.  * features or use of this software display the following acknowledgement:
  12.  * ``This product includes software developed by the University of California,
  13.  * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
  14.  * the University nor the names of its contributors may be used to endorse
  15.  * or promote products derived from this software without specific prior
  16.  * written permission.
  17.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  18.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  19.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  20.  *
  21.  * @(#) $Header: interface.h,v 1.66 94/06/14 20:21:37 leres Exp $ (LBL)
  22.  */
  23.  
  24. #ifdef __GNUC__
  25. #define inline __inline
  26. #ifndef __dead
  27. #define __dead volatile
  28. #endif
  29. #else
  30. #define inline
  31. #define __dead
  32. #endif
  33.  
  34. #include "os.h"            /* operating system stuff */
  35. #include "md.h"            /* machine dependent stuff */
  36.  
  37. #ifndef SIGRET
  38. #define SIGRET void        /* default */
  39. #endif
  40.  
  41. struct token {
  42.     int v;            /* value */
  43.     char *s;        /* string */
  44. };
  45.  
  46. extern int dflag;        /* print filter code */
  47. extern int Dflag;        /* print data in ASCII */
  48. extern int eflag;        /* print ethernet header */
  49. extern int nflag;        /* leave addresses as numbers */
  50. extern int Nflag;        /* remove domains from printed host names */
  51. extern int qflag;        /* quick (shorter) output */
  52. extern int Sflag;        /* print raw TCP sequence numbers */
  53. extern int tflag;        /* print packet arrival time */
  54. extern int vflag;        /* verbose */
  55. extern int xflag;        /* print packet in hex */
  56.  
  57. extern char *program_name;    /* used to generate self-identifying messages */
  58.  
  59. extern int snaplen;
  60. /* global pointers to beginning and end of current packet (during printing) */
  61. extern const u_char *packetp;
  62. extern const u_char *snapend;
  63.  
  64. /* extern int fddipad; */    /* alignment offset for FDDI headers, in bytes */
  65.  
  66. /* Eliminate some bogus warnings. */
  67. struct timeval;
  68.  
  69. typedef void (*printfunc)(u_char *, struct timeval *, int, int);
  70.  
  71. extern void ts_print(const struct timeval *);
  72. extern int clock_sigfigs(void);
  73. int gmt2local(void);
  74.  
  75. extern int fn_print(const u_char *, const u_char *);
  76. extern int fn_printn(const u_char *, u_int, const u_char *);
  77. extern const char *tok2str(const struct token *, const char *, int);
  78. extern char *dnaddr_string(u_short);
  79. extern char *savestr(const char *);
  80.  
  81. extern int data_print(register u_char *, register int);
  82.  
  83. extern int initdevice(char *, int, int *);
  84. extern void wrapup(int);
  85.  
  86. extern __dead void error(char *, ...);
  87. extern void warning(char *, ...);
  88.  
  89. extern char *read_infile(char *);
  90. extern char *copy_argv(char **);
  91.  
  92. extern void usage(void);
  93. extern char *isonsap_string(const u_char *);
  94. extern char *llcsap_string(u_char);
  95. extern char *protoid_string(const u_char *);
  96. extern char *dnname_string(u_short);
  97. extern char *dnnum_string(u_short);
  98.  
  99. /* The printer routines. */
  100.  
  101. struct pcap_hdr;
  102.  
  103. extern void ether_if_print(u_char *, const struct pcap_hdr *,
  104.                const u_char *);
  105. extern void fddi_if_print(u_char *, const struct pcap_hdr *, const u_char*);
  106. extern void null_if_print(u_char *, const struct pcap_hdr *, const u_char*);
  107. extern void ppp_if_print(u_char *, const struct pcap_hdr *, const u_char *);
  108. extern void sl_if_print(u_char *, const struct pcap_hdr *, const u_char *);
  109.  
  110. extern void arp_print(const u_char *, int, int);
  111. extern void ip_print(const u_char *, int);
  112. extern void tcp_print(const u_char *, int, const u_char *);
  113. extern void udp_print(const u_char *, int, const u_char *);
  114. extern void icmp_print(const u_char *, const u_char *);
  115. extern void default_print(const u_char *, int);
  116. extern void default_print_unaligned(const u_char *, int);
  117.  
  118. extern void aarp_print(const u_char *, int);
  119. extern void atalk_print(const u_char *, int);
  120. extern void bootp_print(const u_char *, int, u_short, u_short);
  121. extern void decnet_print(const u_char *, int, int);
  122. extern void egp_print(const u_char *, int, const u_char *);
  123. extern int ether_encap_print(u_short, const u_char *, int, int);
  124. extern void ipx_print(const u_char *, int length);
  125. extern void isoclns_print(const u_char *, int, int,
  126.               const u_char *, const u_char *);
  127. extern int llc_print(const u_char *, int, int, const u_char *, const u_char *);
  128. extern void nfsreply_print(const u_char *, int, const u_char *);
  129. extern void nfsreq_print(const u_char *, int, const u_char *);
  130. extern void ns_print(const u_char *, int);
  131. extern void ntp_print(const u_char *, int);
  132. extern void ospf_print(const u_char *, int, const u_char *);
  133. extern void rip_print(const u_char *, int);
  134. extern void snmp_print(const u_char *, int);
  135. extern void sunrpcrequest_print(const u_char *, int, const u_char *);
  136. extern void tftp_print(const u_char *, int);
  137. extern void wb_print(const void *, int);
  138.  
  139. #define min(a,b) ((a)>(b)?(b):(a))
  140. #define max(a,b) ((b)>(a)?(b):(a))
  141.  
  142. /*
  143.  * The default snapshot length.  This value allows most printers to print
  144.  * useful information while keeping the amount of unwanted data down.
  145.  * In particular, it allows for an ethernet header, tcp/ip header, and
  146.  * 14 bytes of data (assuming no ip options).
  147.  */
  148. #define DEFAULT_SNAPLEN 68
  149.  
  150. #ifndef BIG_ENDIAN
  151. #define BIG_ENDIAN 4321
  152. #define LITTLE_ENDIAN 1234
  153. #endif
  154.